#-*-coding:utf-8-*-
import hou
class General_user_Interface(object):
    '''
    关于General_user_Interface中的所有设置
    '''
    def __init__(self):
        super(General_user_Interface,self).__init__()

    def setDrawLinesSmoothly(self,bool):
        if bool == True:
            hou.setPreference('general.smoothlines.val', '1')
            # print('1')
        else:
            hou.setPreference('general.smoothlines.val', '0')
            # print('0')

    def getDrawLinesSmoothly(self,bool):
        return hou.getPreference('general.smoothlines.val')
        # print('getDrawLinesSmoothly')



    def setColorPaneHeadersWithNetworkContexts(self,bool):

        if bool == True:
            hou.setPreference('general.panecoloring.val', '1')
            # print('1')
        else:
            hou.setPreference('general.panecoloring.val', '0')
            # print('0')

    def getColorPaneHeadersWithNetworkContexts(self):
        return hou.getPreference('general.panecoloring.val')
        # print('getColorPaneHeadersWithNetworkContexts')


    def setShowImagesForImageFilesInFileBrowser(self,bool):
        if bool == True:
            hou.setPreference('general.filebrowserimages.val', '1')
            # print('1')
        else:
            hou.setPreference('general.filebrowserimages.val', '0')
            # print('0')

    def getShowImagesForImageFilesInFileBrowser(self):
        return hou.getPreference('general.filebrowserimages.val')
        # print('getColorPaneHeadersWithNetworkContexts')



    def setLeftHandMenus(self,bool):
        if bool == True:
            hou.setPreference('general.lefthandmenus.val', '1')
            # print('1')
        else:
            hou.setPreference('general.lefthandmenus.val', '0')
            # print('0')


    def getLeftHandMenus(self):
        return hou.getPreference('general.lefthandmenus.val')
        # print('getLeftHandMenus')



    def setPlayAudioWithPopupNotificationsFor_Errors(self,bool):
        if bool == True:
            hou.setPreference('general.audionotice_error.val','1')
            # print('1')
        else:
            hou.setPreference('general.audionotice_error.val','0')
            # print('0')

    def getPlayAudioWithPopupNotificationsFor_Errors(self):
        return hou.getPreference('general.audionotice_error.val')
        # print('getPlayAudioWithPopupNotificationsFor_Errors')


    def setPlayAudioWithPopupNotificationsFor_Warnings(self,bool):
        if bool == True:
            hou.setPreference('general.audionotice_error.val','1')
            # print('1')
        else:
            hou.setPreference('general.audionotice_error.val','0')
            # print('0')

    def getPlayAudioWithPopupNotificationsFor_Warnings(self):
        return hou.getPreference('general.audionotice_warning.val')
        # print('getPlayAudioWithPopupNotificationsFor_Warnings')


    def setPlayAudioWithPopupNotificationsFor_Messages(self,bool):
        if bool == True:
            hou.setPreference('general.audionotice_message.val','1')
            # print('1')
        else:
            hou.setPreference('general.audionotice_message.val','0')
            # print('0')

    def getPlayAudioWithPopupNotificationsFor_Messages(self):
        return hou.getPreference('general.audionotice_message.val')
        # print('getPlayAudioWithPopupNotificationsFor_Messages')


    def setPlayAudioWithPopupNotificationsFor_Questions(self,bool):
        if bool == True:
            hou.setPreference('general.audionotice_question.val','1')
            # print('1')
        else:
            hou.setPreference('general.audionotice_question.val','0')
            # print('0')

    def getPlayAudioWithPopupNotificationsFor_Questions(self):
        return hou.getPreference('general.audionotice_question.val')
        # print('getPlayAudioWithPopupNotificationsFor_Questions')


    def setStartupInDesktop(self,desktopName):
        '''
        :param desktopName: Animate,Build,Games,Grooming,Image,
        LookDev,Modeling,Output,Technical,Terrain,Textport等以及自定义桌面布局
        :return:
        '''

        hou.setPreference('general.desk.val',desktopName)
        # print('setStartupInDesktop')

    def getStartupInDesktop(self):
        return hou.getPreference('general.desk.val')
        # print('getStartupInDesktop')



    def setPlaybarUI(self,UIname):
        '''
        :param UIname: Normal,Compact
        :return:
        '''
        if UIname =='Normal' or UIname == 0:
            hou.setPreference('general.uiplaybar.menu', '0')
            # print('Normal')
        elif UIname == 'Compact' or UIname == 1:
            hou.setPreference('general.uiplaybar.menu', '1')
            # print('Compact')


    def getPlaybarUI(self):
        return hou.getPreference('general.uiplaybar.menu')
        # print('setPlaybarUI')



    def setGlobalUiSize(self,UiSizeName):
        '''
        :param UiSizeName:Samll,Compact,Normal,Large,High DPI
        :return:
        '''
        if UiSizeName=='Small' or UiSizeName==0:
            hou.setPreference('general.uisize.menu', '0')
            # print('Small')

        elif UiSizeName=='Compact' or UiSizeName==1:
            hou.setPreference('general.uisize.menu', '1')
            # print('Compact')

        elif UiSizeName=='Normal' or UiSizeName==2:
            hou.setPreference('general.uisize.menu', '2')
            # print('Normal')

        elif UiSizeName=='Large' or UiSizeName==3:
            hou.setPreference('general.uisize.menu', '3')
            # print('Large')
        elif UiSizeName=='High DPI' or UiSizeName==4:
            hou.setPreference('general.uisize.menu', '4')
            # print('High DPI')

    def getGlobalUiSize(self):
        return hou.getPreference('general.uisize.menu')
        # print('getGlobalUiSize')

